AC_PREREQ(2.59)

AC_INIT([SLglade], [0.2.0],
	[Chris Stawarz  <cstawarz@cfa.harvard.edu>],
	[slglade])
AC_CONFIG_SRCDIR([src/glade-module.c])
AC_CONFIG_AUX_DIR(config)

# Set preprocessor macros for version number
AC_DEFINE_UNQUOTED(SLGLADE_VERSION_NUMBER, 0*10000+2*100+0)
AC_DEFINE_UNQUOTED(SLGLADE_VERSION_STRING, "$PACKAGE_VERSION")

AM_INIT_AUTOMAKE(slglade,$PACKAGE_VERSION)

AC_ARG_WITH(slanglib,
	[AC_HELP_STRING([--with-slanglib=DIR], [slang library in DIR [/usr/local/lib]])],
	[SLANG_LIB=$withval],
	[SLANG_LIB=/usr/local/lib])

AC_ARG_WITH(slanginc,
	[AC_HELP_STRING([--with-slanginc=DIR], [slang includes in DIR [/usr/local/include]])],
	[SLANG_INC=$withval],
	[SLANG_INC=/usr/local/include])

AC_ARG_WITH(slgtkmod,
	[AC_HELP_STRING([--with-slgtkmod=DIR], [slgtk module in DIR [/usr/local/lib/slang/modules]])],
	[SLGTK_MOD=$withval],
	[SLGTK_MOD=/usr/local/lib/slang/modules])

AC_SUBST(SLANG_LIB)
AC_SUBST(SLANG_INC)
AC_SUBST(SLGTK_MOD)

# Checks for programs.
AC_PROG_AWK
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB

AC_DISABLE_STATIC
AC_PROG_LIBTOOL

# Check if this is a Darwin-based system
kernel_name=`uname -s`
AM_CONDITIONAL(APPLE, test x$kernel_name = xDarwin)

# Get libglade compile and link flags
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
PKG_CHECK_MODULES(SLGLADE, libglade-2.0  )
AC_SUBST(SLGLADE_CFLAGS)
AC_SUBST(SLGLADE_LIBS)

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

# Checks for library functions.
AC_CHECK_FUNCS([memset])

AC_CONFIG_FILES([
	   Makefile
	   doc/Makefile
	   packages/Makefile
	   src/Makefile
	  ])
AC_OUTPUT

